<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2020/7/29 0029
 * Time: 14:05
 */

namespace app\api\controller\v1\agent;


use app\api\controller\v1\Agent;
use think\Db;

class Info extends Agent
{
    public function index()
    {
        $this->success('success',$this->agent);
    }
    /**
     * 修改个人信息
     * @throws \think\Exception
     * @throws \think\exception\PDOException
     */
    public function save()
    {
        $data = $this->_input([
            'name' => $this->request->post('name'),
        ]);
        $data = array_filter($data);
        empty($data) && $this->success('请选择要修改的内容！');
        $res = Db::name('Agent')->where('id','eq',$this->aid)->update($data);
        if($res !== false)
        {
            $this->success('修改成功！');
        } else {
            $this->error('修改失败！');
        }
    }
}